package com.ljb.baseadapter_demo.adapter.lv;

import com.ljb.baseadapter_demo.R;
import com.ljb.baseadapter_demo.bean.ChatMessage;
import com.ljb.baseadapter_listview.ViewHolder;
import com.ljb.baseadapter_listview.ItemViewTemplate;

/**
 * Created by lijianbin on 2016/12/14.
 */
public class MsgSendItemTemplate implements ItemViewTemplate<ChatMessage> {

    @Override
    public int getItemViewLayoutId() {
        return R.layout.item_chat_send_msg;
    }

    @Override
    public boolean isForViewType(ChatMessage chatMessage, int position) {
        return !chatMessage.isComMeg();
    }

    @Override
    public void convert(ViewHolder holder, ChatMessage chatMessage, int position) {
        holder.setText(R.id.chat_send_name, chatMessage.getName());
        holder.setText(R.id.chat_send_content, chatMessage.getContent());
        holder.setImageResource(R.id.chat_send_icon, chatMessage.getIcon());
    }
}
